<template>
  <section @click="clickCurrent('current')" @mousedown="clickCurrent('dragging')">
    <div :class="['custorm--modelbox', 'graphicaudio-show', (custormCurrent == custormIndex)?'drag active':'drag']">
      <div v-if="custormItemData.params.isshow == '2'" class="noshow" v-bind:style="{'background-image':`url(${getPath('noshow.png')})`}"></div>
      <div v-if="custormItemData.style.display == '1'" style="overflow: hidden;">
        <div class="es-audio style1 flex-row" style="margin-top: 5px; margin-bottom: 5px;">
          <div class="img">
            <svg-icon icon-class="bofang" />
          </div>
          <div class="content">
            <div class="name" :style="{'color':custormItemData.params.color}">{{custormItemData.params.title}}</div>
            <div class="cap-slider">
              <div class="cap-slider__bar">
                <span class="cap-slider__finished-portion" style="background-color: rgb(68, 187, 0); width: 0%;"></span>
                <span class="cap-slider__pivot" style="background-color: rgb(255, 255, 255); left: 0%; margin-left: -2px;"></span>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 2 -->
      <div v-if="custormItemData.style.display == '2'" style="overflow: hidden;">
        <div class="es-audio style2 flex-row flex-align-c" style="margin-top: 5px; margin-bottom: 5px;">
          <svg-icon icon-class="bofang" />
          <div class="content">
            <div class="name" :style="{'color':custormItemData.params.color}">{{custormItemData.params.title}}</div>
          </div>
        </div>
      </div>
      <!-- 3 -->
      <div v-if="custormItemData.style.display == '3'" style="overflow: hidden;">
        <div class="es-audio style3" style="margin-top: 5px; margin-bottom: 5px;">
          <div class="img"><img :src="getPath(custormItemData.params.thumb.file_path)" draggable="false"></div>
          <img :src="getPath('audio1.png')" alt="" class="audio1">
        </div>
      </div>
      <!-- 4 -->
      <div v-if="custormItemData.style.display == '4'" style="overflow: hidden;">
        <div class="es-audio style4" style="margin-top: 5px; margin-bottom: 5px;">
          <div class="img"><img :src="getPath(custormItemData.params.thumb.file_path)"></div>
          <img :src="getPath('audio2.png')" alt="" class="audio2">
        </div>
      </div>
      <div class="btn-edit-del" @click="delCurrent"><span class="btn-del icon iconfont icon-close"></span></div>
    </div>
  </section>
</template>

<script>
import defaultConfig from './utils/showConfig'
export default {
  mixins: [defaultConfig.mixins],
  props: {
    defaultConfig: {
      type: Object,
      default: function() {
        return defaultConfig
      }
    }
  },
  methods: {

  }
}
</script>

<style lang="scss" scoped>
.custorm--modelbox.graphicaudio-show {
  .es-audio.style1 {
    height: 43px;
    line-height: 41px;
  }

  .es-audio {
    border: 1px solid #eee;
    padding: 0 15px 0 10px;
    box-sizing: border-box;
    position: relative;
    margin: 0 12px;
    overflow: hidden;
    background: #fff;
    line-height: 1.5;
  }

  .es-audio .img {
    img {
      width: 100%;
      height: 100%;
      max-width: 100%;
      max-height: 100%;
    }
  }

  // 1
  .es-audio.style1 {
    padding: 0;
    height: 60px;
    svg {
      width: 40px;
      height: 40px;
      margin: 9.5px 0 0 9.5px;
      max-width: 100%;
      max-height: 100%;
    }
    .content {
      height: 30px;
      line-height: 30px;
      font-size: 14px;
      padding-left: 18px;
      color: #333;
      flex: 1;

      .cap-slider {
        background-color: #f2f2f2;
        width: 90%;

        .cap-slider__bar {
          position: relative;
          margin: 0 8px 0 0;
          height: 2px;
          border-radius: 0;
          background-color: #f2f2f2;

          .cap-slider__pivot {
            position: absolute;
            top: 50%;
            width: 14px;
            height: 14px;
            border: 1px solid #e5e5e5;
            border-radius: 50%;
            transform: translate3d(0, -50%, 0);
          }

          .cap-slider__pivot::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto;
            width: 4px;
            height: 4px;
            border-radius: 4px;
            background: #409eff;
          }
        }
      }
    }
  }

  // 2
  .es-audio.style2 {
    padding: 0;
    height: 46px;
    padding: 0 12px;
    svg {
      width: 25px;
      height: 25px;
      max-width: 100%;
      max-height: 100%;
    }

    .content {
      float: left;
      height: 46px;
      display: -webkit-box;
      display: -ms-flexbox;
      display: -webkit-flex;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      -webkit-flex-direction: column;
      -webkit-box-pack: center;
      -webkit-justify-content: center;
      -ms-flex-pack: center;
      justify-content: center;
      margin-left: 12px;
    }
  }

  // 3
  .es-audio.style3 {
    padding: 0;
    border: 0;

    .img {
      float: left;
      margin-right: 10px;
      width: 48px;
      height: 48px;
    }

    .audio1 {
      width: 136px;
      display: block;
    }
  }

  // 4
  .es-audio.style4 {
    padding: 0;
    border: 0;
    .img {
      float: right;
      margin-left: 10px;
      width: 48px;
      height: 48px;
    }
    .audio2 {
      width: 136px;
      display: block;
      float: right;
    }
  }
}
</style>
